package vip.mall.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @author ASUS
 * @Date 2025/2/20 15:06
 * @Descripition 订单号产生
 */
public class OrderNumberGen {
    //订单号产生
    public static String getOrderIdByTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate = sdf.format(new Date());
        StringBuilder result = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 5; i++) {
            result.append(random.nextInt(10));
        }
        return newDate + result;
    }
}
